//	ConfigReader.h : simple config file reader
//
//	Author: Miroslav Hauser, hauz@students.zcu.cz
//	Version: 0.8
//
//	Reads simple config file allowing '#' comment and data in <key>=<value>
//	format.
//
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//
#pragma once

#include <string>
#include <map>
#include <exception>

#define	MAX_VALUE_LEN	1024	// maximal lenght of information

using std::string;
using std::map;


class ConfigReader {
public:
	//	Initial class constructor
	//
	//	Arg - file to be read
	ConfigReader(const char *);
	//	Return value regarding to key.
	//
	//	Arg1 - buffer for received data
	//	Arg2 - key leading to data
	//
	void GetKey(char *, const char *);
	// Reads new file and saves its data.
	//
	// Arg - file to be read
	bool ReadFile(const char *);
	// Indicates whether the file was read.
	bool IsRead();
	// Whole configuration data.
	map<string, string> GetConfig();

protected:
	bool				fIsRead;	// file read flag
	map<string, string>	data;		// map holding data

	//	Removes leading and trailing spaces
	void Trim(string *);
	

private:

};